<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020/4/18 0018
  Time: 9:39
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<a href="/jsp/updateNews.jsp">增加新闻</a>
<form action="NewsSelect" method="get">
    标题：<input type="text" id="title" name="title" value="${newsModel.title}">
    内容：<input type="text" id="content" name="content" value="${newsModel.content}">
    创建开始时间：<input type="date" id="startTime" name="startTime" value="${newsModel.startT}">
    结束时间:<input type="date" id="endTime" name="endTime" value="${newsModel.endT}">
    <input type="submit" value="搜索">
</form>
<table class="table table-bordered">
    <tr>
        <td>ID</td>
        <td>标题</td>
        <td>内容</td>
        <td>是否置顶</td>
        <td>是否推荐</td>
        <td>创建时间</td>
        <td>操作</td>
    </tr>
    <c:forEach items="${list}" var="model">
        <tr>
            <td>${model.id}</td>
            <td>${model.title}</td>
            <td>${model.content}</td>
            <td>
                <c:if test="${model.isTuijian==1}">
                    是
                </c:if>
                <c:if test="${model.isTuijian==0}">
                    否
                </c:if>
            </td>
            <td>
                <c:if test="${model.isTop==1}">
                    是
                </c:if>
                <c:if test="${model.isTop==0}">
                    否
                </c:if>
            </td>
            <td>${model.createTime}</td>
            <td>
                <a href="findNewsById?id=${model.id}">修改</a>
                <a href="deleteNewsById?id=${model.id}"> 删除</a>
            </td>
        </tr>
    </c:forEach>

</table>
<div style="display: flex;justify-content: center">
    总共${pageModel.allCount}条
    总共${pageModel.allPage}页
    当前${pageModel.pageNum}页
    <a href="newsPage?type=first&pageNum=${pageModel.pageNum}">首页</a>
    <a href="newsPage?type=last&pageNum=${pageModel.pageNum}">上一页</a>
    <a href="newsPage?type=next&pageNum=${pageModel.pageNum}">下一页</a>
    <a href="newsPage?type=end&pageNum=${pageModel.pageNum}">尾页</a>
</div>
</body>
</html>
